

*****+****************+****************+****************+****************+****************+****************+*******************
****+ Replication File for Reining in Rebellion: The Decline of Political Violence in South America, 1830–1929 *****+**********
*****+****************+****************+****************+****************+****************+****************+*******************
***** Raúl L. Madrid and Luis L. Schenoni *************************************************************************************
*****+****************+****************+****************+****************+****************+****************+*******************


*** Open Original Dataset 

use "LARD country year.dta"


*** Merger of MIDs

merge 1:1 cowcodes year using "MidsData.dta"

drop if countrycode == .

replace midy = 0 if (midy >= .)

replace middum = 0 if (middum >= .)


*** Merger of Exports

drop _merge

merge 1:1 cowcodes year using "BanksData.dta"


*** Coding Defeat

gen defeat = 0


* Argentina
replace defeat = 1 if ccode == 160 & year > 1827 & year < 1843
replace defeat = 1 if ccode == 160 & year > 1852 & year < 1863

* Bolivia
replace defeat = 1 if ccode == 145 & year > 1880 & year < 1895

* Brazil
replace defeat = 1 if ccode == 140 & year > 1827 & year < 1843

* Peru
replace defeat = 1 if ccode == 135 & year > 1838 & year < 1854
replace defeat = 1 if ccode == 135 & year > 1883 & year < 1897

* Paraguay
replace defeat = 1 if ccode == 150 & year > 1869 & year < 1884

* Ecuador
replace defeat = 1 if ccode == 130 & year > 1862 & year < 1877


*** Extend coverage of appointments for Peru

replace v2stcritapparm_osp = 1.321 if ccode == 135 & year > 1920 & year < 1930



*** Amendments (Mato Grosso, Sabinada, Domingo Elias)

* Brazil Mato Grosso 1892
replace Numberofoutsiderrevolts = 1 if ccode == 140 & year == 1892
replace Numberofmilitarycoups = 0 if ccode == 140 & year == 1892
replace Eliteopp1strevolt = 1 if ccode == 140 & year == 1892
replace Militarycoup1strevolt = 0 if ccode == 140 & year == 1892

* Brazil Sabinada 1837-1838
replace Numberofoutsiderrevolts = 3 if ccode == 140 & year < 1839 & year > 1836
replace Numberofmilitarycoups = 0 if ccode == 140 & year < 1839 & year > 1836
replace Popularrebellion3rdrevolt = 1 if ccode == 140 & year < 1839 & year > 1836
replace Militarycoup3rdrevolt = 0 if ccode == 140 & year < 1839 & year > 1836

* Peru Elias 1845
replace Numberofoutsiderrevolts = 1 if ccode == 135 & year == 1844
replace Numberofmilitarycoups = 1 if ccode == 135 & year == 1844
replace Eliteopp2ndrevolt = 0 if ccode == 135 & year == 1844
replace Militarycoup2ndrevolt = 1 if ccode == 135 & year == 1844



***************************
*** Main in-text models ***
***************************


* Count variable (outcome) characteristics 

tabstat Numberofoutsiderrevolts, stat(mean var)


* Re-scaling of variables

gen COWmilper2 = COWmilper/10

gen v2stcritapparm_osp2 = v2stcritapparm_osp*10

gen polyarchysquared2 = polyarchysquared*100

gen v2x_polyarchy2 = v2x_polyarchy*10

gen e_miurbani2 = e_miurbani*10

gen logpop2 = logpop*10

gen railroad12 = railroad1/1000

gen telegraph12 = telegraph1/100

gen exports2 = exports/100



xtset countrycode year


* Comparing zero inflated to poisson

zip Numberofoutsiderrevolts COWmilper2 v2stcritapparm_osp2 numacadToronto2018 i.countrycode i.year, vce(cluster countrycode) inflate(year) 

estimates store zip

xi: poisson Numberofoutsiderrevolts COWmilper2 v2stcritapparm_osp2 numacadToronto2018 i.countrycode i.year, vce(cluster countrycode)

estimates store pois

estimates stats pois zip



* Model 1

xi: poisson Numberofoutsiderrevolts COWmilper2 v2stcritapparm_osp2 numacadToronto2018 i.countrycode i.year, vce(cluster countrycode)

estimates store mod1

* Model 2

xi: poisson Numberofoutsiderrevolts COWmilper2 v2stcritapparm_osp2 numacadToronto2018 e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 i.countrycode i.year, vce(cluster countrycode)

estimates store mod2

* Model 3 

xi: poisson Numberofoutsiderrevolts COWmilper2 v2stcritapparm_osp2 numacadToronto2018 e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 yearssinceindependence i.countrycode, vce(cluster countrycode)

estimates store mod3

* Model 4 

xi: poisson Numberofoutsiderrevolts COWmilper2 v2stcritapparm_osp2 numacadToronto2018 e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 irgdpnapcmaddison2018 i.countrycode i.year, vce(cluster countrycode)

estimates store mod4



estout mod1 mod2 mod3 mod4, cells(b(star fmt(3)) se(par fmt(2)))



***************
*** Figures ***
***************


* Figure 6

coefplot (mod1, label(Baseline model) offset (.30)) (mod2, label(Model with confounders) offset (.10)) (mod3, label(Model with count variable (country-FE)) offset (-.10)) (mod4, label(Model with GDP (drops observations)) offset (-.30)), keep(COWmilper2 v2stcritapparm_osp2 numacadToronto2018 e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 yearssinceindependence irgdpnapcmaddison2018) omitted eform xline(1, lcolor(black) lwidth(thin)) scheme(s1mono) byopts(xrescale cols(2)) graphregion(col(white)) bgcol(white) coeflabels(COWmilper2="Military Personnel" v2stcritapparm_osp2="Professionalization" numacadToronto2018="Military Academies" e_miurbani2="Urbanization" v2x_polyarchy2="Democracy" polyarchysquared2="Democracy(squared)" midy="MIDs" defeat="Defeat" exports2="Exports" telegraph12="Telegraphs" railroad12="Railroads" logpop2="Population(log)" irgdpnapcmaddison2018="GDP per capita" yearssinceindependence="Yearly Count")



* Figure 1

use "LARD country year.dta"

replace Revoltswith5000rebels = 1 if (Revoltswith5000rebels > 0)

replace Monthsofrevoltsthat = 0 if (Monthsofrevoltsthat < 12)
replace Monthsofrevoltsthat = 1 if (Monthsofrevoltsthat > 11)

egen sumtotalrevolts = sum(Revoltsthatyear), by(decade)
egen sumtotaloverthrow = sum(Overthrownpresidentsi), by(decade)
egen sumtotalparticipation = sum(Revoltswith5000rebels), by(decade)
egen sumtotalyearly = sum(Monthsofrevoltsthat), by (decade)
 
label variable sumtotalrevolts "Major Revolts"
label variable sumtotaloverthrow "Revolts toppling the Chief Executive"
label variable sumtotalparticipation "Revolts involving > 5000 Insurgents"
label variable sumtotalyearly "Revolts lasting > 12 Months "

tw line sumtotalrevolts sumtotaloverthrow sumtotalparticipation sumtotalyearly decade, sort scheme(s2mono) 

clear




* Figure 2

use "LARD country year.dta"

sum Revoltsthatyear if year < 1900

sum Revoltsthatyear if year > 1899

graph bar Revoltsthatyear, over(century) over(countryname) asyvars scheme(s2mono) 



* Figure 4

use "LARD revolt level.dta"

drop if mrevolt==0

drop if type==3
label define labeltype 4"Coup" 2"Factional Rebellion" 1"Popular Uprising"
label values type labeltype

replace overthrow = 1 if (overthrow==2)
replace overthrow = 0 if (overthrow==3)
replace overthrow = 2 if (overthrow==0)
label define labeloverthrow 1"Successful Overthrow" 2"Continuity of Chief Executive"
label values overthrow labeloverthrow

graph pie, over(overthrow) plabel(_all percent) by(type) scheme(s2mono)


replace duration = 3 if (duration==2)
replace duration = 0 if (duration==4)
label define labelduration 0"> 1 year" 3"1 month to 1 year" 1"< 1 month"
label values duration labelduration

graph pie, over(duration) plabel(_all percent) by(type) scheme(s2mono)


replace violence = 0 if (violence==3)
label define labelviolence 1"< 100 deaths" 2"100 to 999 deaths" 0"> 1000 deaths"
label values violence labelviolence

graph pie, over(violence) plabel(_all percent) by(type) scheme(s2mono)


clear


* Figure 5
  
use "LARD country year.dta"

replace Militarycoup1strevolt = 0 if (Militarycoup1strevolt==.)
replace Militarycoup2ndrevolt = 0 if (Militarycoup2ndrevolt==.)
replace Militarycoup3rdrevolt = 0 if (Militarycoup3rdrevolt==.)
replace Militarycoup4threvolt = 0 if (Militarycoup4threvolt==.)

gen totalcoups = 0

replace totalcoups = Militarycoup1strevolt + Militarycoup2ndrevolt + Militarycoup3rdrevolt + Militarycoup4threvolt
  
replace Eliteopp1strevolt = 0 if (Eliteopp1strevolt==.)
replace Eliteopp2ndrevolt = 0 if (Eliteopp2ndrevolt==.)
replace Eliteopp3rdrevolt = 0 if (Eliteopp3rdrevolt==.)
replace Eliteopp4threvolt = 0 if (Eliteopp4threvolt==.)

 gen totalfacreb = 0
 
 replace totalfacreb = Eliteopp1strevolt + Eliteopp2ndrevolt + Eliteopp3rdrevolt + Eliteopp4threvolt
 
replace PopularRebellion1strevolt = 0 if (PopularRebellion1strevolt==.)
replace Popularrebellion2ndrevolt = 0 if (Popularrebellion2ndrevolt==.)
replace Popularrebellion3rdrevolt = 0 if (Popularrebellion3rdrevolt==.)
replace Popularrebellion4threvolt = 0 if (Popularrebellion4threvolt==.)
 
  gen totalpopup = 0
 
 replace totalpopup = PopularRebellion1strevolt + Popularrebellion2ndrevolt + Popularrebellion3rdrevolt + Popularrebellion4threvolt
 
egen sumtotalpopup = sum(totalpopup), by(decade)
egen sumtotalfacreb = sum(totalfacreb), by(decade) 
egen sumtotalcoups = sum(totalcoups), by(decade) 
gen sumoutsider = sumtotalfacreb + sumtotalpopup
 
 label variable sumoutsider "Outsider Revolts"
 label variable sumtotalcoups "Insider Revolts"
 
tw connected sumoutsider sumtotalcoups decade, sort scheme(s2mono) 

 
 

*************************************
*** Additional Models and Figures ***
*************************************

* Model 2a

xi: poisson Numberofoutsiderrevolts v2stcritapparm_osp2 numacadToronto2018 e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 i.countrycode i.year, vce(cluster countrycode)

* Model 2b

xi: poisson Numberofoutsiderrevolts COWmilper2 v2stcritapparm_osp2 e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 i.countrycode i.year, vce(cluster countrycode)

* Model 2c

xi: poisson Numberofoutsiderrevolts COWmilper2 numacadToronto2018 e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 i.countrycode i.year, vce(cluster countrycode)

* Model 2d

xi: poisson Numberofoutsiderrevolts e_miurbani2 v2x_polyarchy2 polyarchysquared2 midy defeat exports2 telegraph12 railroad12 logpop2 i.countrycode i.year, vce(cluster countrycode)


* Figure 1

xtline Numberofoutsiderrevolts, recast(spike) lwidth(medthick) scheme(s2mono) lpattern(dot) i(countryname) t(year)

* Figure 2
 
xtline Numberofmilitarycoups, recast(spike) lwidth(medthick) scheme(s2mono) lpattern(dot) i(countryname) t(year)



